package com.andnnl.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * peek无返回值
 * Created by chenss on 2021/5/7.
 */
public class PeekTest {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("aa", "bb");
        List<String> list2=list.stream().map(name -> name += "aaa").collect(Collectors.toList());

        list.stream().peek(name -> {
            System.out.println(name);
        }).count();
        list2.stream().peek(name -> {
            System.out.println(name);
        }).count();
    }
}
